com.cete.dynamicpdf
Class JavaScriptAction



Example: This following example shows how to use the JavaScriptAction on a button.

import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.forms.*;
 
public class MyClass{
    public static void main(String args[]) {
        // Create a PDF Document
        Document document = new Document();
        
        // Create a PDF Page
        Page page = new Page( PageSize.LETTER );
        
        // Create an Button
        Button button = new Button( "btn", 50, 50, 100, 50 );
        button.setAction(new JavaScriptAction( "app.alert('Hello');" ));
        button.setBehavior(Behavior.createPush( "downLabel", "rolloverLabel" ));
        button.setLabel( "Push" );
        
        // Add the Button to the page
        page.getElements().add( button );
        
        // Add pages to the document
        document.getPages().add( page );
        
        // Save the PDF document
        document.draw("[PhysicalPath]/MyDocument.pdf");
    }
 }